package douyin

import (
	doudian_sdk "doudian.com/open/sdk_golang/core"
)

const (
	AppKey    = "7211045105476568615"
	AppSecret = "e4cf2f80-e04d-439f-836e-d03f10278e10"
	ServiceId = "25103"
)

type DecryptJsons struct {
	Code    int         `json:"code"`
	ErrNo   int         `json:"err_no"`
	LogId   string      `json:"log_id"`
	Message string      `json:"message"`
	Msg     string      `json:"msg"`
	SubCode string      `json:"sub_code"`
	SubMsg  string      `json:"sub_msg"`
	Data    interface{} `json:"data"`
}

func GetDouyinToken(Code string) (*doudian_sdk.AccessToken, error) {
	// 设置appKey和appSecret，全局设置一次
	doudian_sdk.GlobalConfig.AppKey = AppKey
	doudian_sdk.GlobalConfig.AppSecret = AppSecret
	accessToken, err := doudian_sdk.BuildAccessToken(&doudian_sdk.BuildAccessTokenParam{Code: Code})
	return accessToken, err
}
